Field
The disclosed embodiments relate to techniques for reducing the memory requirements of a software program. More specifically, the disclosed embodiments relate to techniques for densely storing strings within the memory of a software program.
Related Art
Software programs create and manage strings to represent words, sentences, and other forms of text. Some programming languages implement strings as objects that encapsulate sequences of characters in a particular character encoding. The string objects may store characters in a two-byte encoding, which may allow software programs to support complex characters. Complex characters are found outside of most Western European languages and may include Cyrillic characters, Hebrew characters, characters found in East Asian languages, and additional characters that are otherwise not supported by single-byte encoding.
However, encoding all characters in multiple bytes may result in larger string objects. This may cause software programs to use significantly more memory if they deal with very long strings and/or numerous strings. Hence, what is needed is a string implementation that both conserves memory and supports complex characters during the execution of a software program.